<%--
  Created by IntelliJ IDEA.
  User: dqf
  Date: 2015/3/2
  Time: 16:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<input type="hidden" name="modify" id="modify" value="<s:property value="modify" />">
<div class="row">

    <!-- NEW WIDGET START -->
    <article class="col-sm-12 col-md-12 col-lg-12">
        <div style="margin-bottom: 10px">
            <a class="btn btn-default" id="btn-re-common" href="javascript:void(0)">
                <i class="fa fa-lg fa-mail-reply-all"></i>项目信息
            </a>
        </div>

        <ul id="myTab1" class="nav nav-tabs bordered  ">
            <li class="active">
                <a href="#s1" data-toggle="tab"><i class="fa fa-fw fa-lg fa-credit-card"></i> 项目基本信息 </a>
            </li>
            <li>
                <a href="#s2" id="proAttend" data-toggle="tab"><i class="fa fa-fw fa-lg fa-th-list"></i> 考勤设置 </a>
            </li>
            <li>
                <a href="#s3" id="proSignIn" data-toggle="tab"><i class="fa fa-fw fa-lg fa-calendar"></i> 考勤日历 </a>
            </li>
            <li>
                <a href="#s4" id="proBack" data-toggle="tab"><i class="fa fa-fw fa-lg fa-info"></i> 项目反馈 </a>
            </li>
            <li>
                <a href="#s5" id="proInfoLog" data-toggle="tab"><i class="fa fa-fw fa-lg fa-users"></i> 项目成员 </a>
            </li>
        </ul>

        <div id="myTabContent1" class="tab-content padding-10 ">

            <div class="tab-pane fade in active " id="s1" style="margin: 10px;">

                <div class="row">
                    <shiro:hasAnyRoles name="wechat">
                    <a class="btn btn-default pull-right pull-right-fix" id="btn-comment" href="javascript:void(0);"><i class="fa fa-lg fa-comment-o"></i> 批注</a>
                        <s:if test="isCreater(proInfo.id)!=''">
                        <a class="btn btn-default pull-right pull-right-fix" id="btn-edit-common" href="javascript:void(0);"><i class="fa fa-lg fa-pencil"></i> 编辑</a>
                        </s:if>
                    </shiro:hasAnyRoles>
                </div>
                <hr class="simple">
                <form id="proInfo" class="smart-form" novalidate="novalidate" action="" method="post">
                    <input type="hidden" name="keyId" id="keyId" value="<s:property value="proInfo.id" />"/>

                    <fieldset>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                项目名称
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input type="text" name="name" id="name" placeholder="请输入项目名称" value="<s:property value="proInfo.name"/>" disabled>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                项目类别
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input type="text" name="categoryName" id="categoryName" value="<s:property value="proInfo.category.name"/>" disabled>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                客户名称
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input disabled type="text" id="clientName"
                                           value="<s:property value="proInfo.client.name"/>" />
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                联系人
                            </label>
                            <section class="col col-5">
                                <label class="input">
                                    <label class="input state-disabled">
                                        <input disabled type="text" id="linkmanName"
                                               value="<s:property value="proInfo.linkman.name"/>"/>
                                    </label>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                手机
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input disabled type="text" id="linkmanMobile"
                                           value="<s:property value="proInfo.linkman.mobile"/>"/>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                所在地区
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input type="text" name="area" id="area" value="<s:property value="area"/>" disabled>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                项目地址
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input type="text" name="address" id="address" placeholder="请输入项目地址" value="<s:property value="proInfo.address"/>" disabled>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                项目总监
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input disabled type="text" id="chiefName"
                                           value="<s:property value="proInfo.chief.name"/>"/>
                                    <input type="text" id="chiefId"
                                           value="<s:property value="proInfo.chief.id"/>" style="display: none"/>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                项目组成员
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input disabled type="text" id="groupName"
                                           value="<s:iterator id="list" value="proInfo.group"><s:property value="#list.name"/>,</s:iterator>"/>

                                </label>
                            </section>
                        </div>

                        <div class="row">
                            <label class="label col col-2">
                                <i class="fa fa-asterisk txt-color-red"></i>
                                启动时间
                            </label>
                            <section class="col col-5">
                                <label class="input">
                                    <i class="icon-append fa fa-calendar"></i>
                                    <input class="hasDatepicker form-control" name="start" id="start" placeholder="请选择项目启动时间"
                                           type="text" value="<s:date name="proInfo.start" format="yyyy-MM-dd"/>" disabled>
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">完成时间</label>
                            <section class="col col-5">
                                <label class="input">
                                    <i class="icon-append fa fa-calendar"></i>
                                    <input disabled class="hasDatepicker form-control" id="end"
                                           type="text" value="<s:date name="proInfo.end" format="yyyy-MM-dd"/>">
                                </label>
                            </section>
                        </div>
                        <div class="row">
                            <label class="label col col-2">
                                新建人
                            </label>
                            <section class="col col-5">
                                <label class="input state-disabled">
                                    <input disabled type="text" value="<s:property value="proInfo.creater.name"/>" />
                                </label>
                            </section>
                        </div>
                    </fieldset>
                </form>
            </div>


            <div class="tab-pane fade in" id="s2" style="margin: 10px">

            </div>

            <div class="tab-pane fade in " id="s3" style="margin: 10px">

            </div>

            <div class="tab-pane fade in " id="s4" style="margin: 10px">

            </div>

            <div class="tab-pane fade in " id="s5" style="margin: 10px">

            </div>

        </div>
    </article>
</div>

<script>

    //返回视图
    $("#btn-re-common").click(function(){
        if($('div#business_data').size()>0){
            loadURL("ajax-project!view.action",$('div#business_data'));
        }else{
            loadURL("ajax!client.action",$('div#content'));
        }
    });

    //编辑
    $("#btn-edit-common").click(function(){
        loadURL("ajax-project!input.action?keyId="+$("input#keyId").val(),$('div#business_data'));
    });


    $("a#proAttend").off("click").on("click",function(e){
        loadURL("ajax-pro-attend!view.action?proInfoId="+$("#keyId").val(),$('div#s2'));
    });

    $("a#proSignIn").off("click").on("click",function(e){
        loadURL("ajax-pro-signin!calendar.action?proInfoId="+$("#keyId").val(),$('div#s3'));
    });

    $("a#proBack").off("click").on("click",function(e){
        loadURL("ajax-pro-back!tabview.action?proInfoId="+$("#keyId").val(),$('div#s4'));
    });

    $("a#proInfoLog").off("click").on("click",function(e){
        loadURL("ajax-proinfo-log!read.action?proInfoId="+$("#keyId").val(),$('div#s5'));
    });

</script>
<script type="text/javascript">
    $("#btn-comment").off("click").on("click",function(){
        var actionUrl = "ajax-comment!list.action";
        var id = $("form#proInfo input#keyId").val();
        var data = {keyId:id};
            $(this).leftview('init',{
            title:"批注信息",
            actionUrl:actionUrl,
            data:data
        });
        $(this).leftview('foot',{callback:common_click});

    });
    function common_click(){
        $("#left_foot_btn_comment").off("click").on("click",function(){
            var text = $("#chat_textarea-expand").val();
            var toUserId=$("input#toUserId").val();
            var parentId=$("#chat_keyId li:first").attr("id");
            if(toUserId==null || toUserId==""){
                toUserId=$("#chiefId").val();
            }
            var actionUrl = "ajax-comment!save.action";
            var id = $("form#proInfo input#keyId").val();

//            var chiefId = $("#chiefId").val();
//            var parentId = $("#chat_keyId li:first").attr("id");
            var data = {
                targetId:id,
                parentId:parentId,
                text:text,
                toUsersId:toUserId,
                targetObject:"com.joint.core.entity.ProInfo"
            };
            ajax_action(actionUrl,data,null,function(data){
                _show(data);
                $(this).leftview('leftClose');
            });
        })
    }

</script>
<script>
    $(function(){
        var modify=$("#modify").val();
        if(modify!=null && "c"==modify){
            $("#chiefName").val("");
        }
        if(modify!=null && "u"==modify){
            $("#groupName").val("");
        }
        if(modify!=null && "cu"==modify){
            $("#chiefName").val("");
            $("#groupName").val("");
        }
    });
</script>

